﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Web;
using System.Web.Mvc;
using TestMySql.Models;

namespace TestMySql.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var context = new EfDbContext();
            context.Set<DmsUser>().Add(new DmsUser()
            {
                Name = "hello world"
            });
            context.SaveChanges();

            var q = from c in context.Set<DmsUser>()
                where c.Name == "hello world"
                select c;
            var t = q.FirstOrDefault();
            t.Name = "kkkk";

            context.SaveChanges();
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}